package cn.itcast.bos.action.base;

import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import cn.itcast.bos.domain.base.TakeTime;
import cn.itcast.bos.service.base.TakeTimeService;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

@ParentPackage("json-default")
@Namespace("/")
@Controller
@Scope("prototype")
public class TakeTimeAction extends ActionSupport implements
		ModelDriven<TakeTime> {
	// 注入业务层
	@Autowired
	private TakeTimeService tts;
	private TakeTime tt = new TakeTime();

	@Override
	public TakeTime getModel() {
		// TODO Auto-generated method stub
		return tt;
	}
	@Action(value="taketime_findAll",results={@Result(name="success",type="json")})
	public String taketime_findAll(){
		//调用业务层查询所有的派送时间
		List<TakeTime> list = tts.finAll();
		//压入值栈
		ActionContext.getContext().getValueStack().push(list);
		return SUCCESS;
		
		
	}
}
